//
//  AccountSecurityViewController.m
//  Mall
//
//  Created by 孙飞燕 on 16/10/20.
//  Copyright © 2016年 孙飞燕. All rights reserved.
//

#import "AccountSecurityViewController.h"
#import "ASFirstTableViewCell.h"
#import "ASSecondTableViewCell.h"
#import "ASThirdTableViewCell.h"
@interface AccountSecurityViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *dataSourceArr;
@end

@implementation AccountSecurityViewController
- (NSMutableArray *)dataSourceArr{
    if (!_dataSourceArr) {
        _dataSourceArr = [NSMutableArray arrayWithObjects:@"会员名",@"修改手机号码",@"修改登录密码", nil];
    }
    return _dataSourceArr;
}
- (UITableView *)tableView{
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:self.view.frame];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        //注册cell
        [_tableView registerNib:[UINib nibWithNibName:@"ASFirstTableViewCell" bundle:nil] forCellReuseIdentifier:@"ASFirstTableViewCell"];
        [_tableView registerNib:[UINib nibWithNibName:@"ASSecondTableViewCell" bundle:nil] forCellReuseIdentifier:@"ASSecondTableViewCell"];
        [_tableView registerNib:[UINib nibWithNibName:@"ASThirdTableViewCell" bundle:nil] forCellReuseIdentifier:@"ASThirdTableViewCell"];

        _tableView.backgroundColor = [UIColor groupTableViewBackgroundColor];
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    }
    return _tableView;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.tableView];
    // Do any additional setup after loading the view.
}
#pragma mark --- UITableView的代理方法
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 4;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {

        ASFirstTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ASFirstTableViewCell" forIndexPath:indexPath];
        cell.firstLabel.text = @"会员名";
        cell.secondLabel.text = @"孙燕子1993";

        return cell;

    }else if (indexPath.row == 1){

        ASSecondTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ASSecondTableViewCell" forIndexPath: indexPath];
        cell.firstLabel.text = @"修改手机号码";
        cell.secondLabel.text = @"157****7221";

        return cell;

    }else if(indexPath.row == 2){

        ASSecondTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ASSecondTableViewCell" forIndexPath: indexPath];
        cell.firstLabel.text = @"修改登录密码";
        cell.secondLabel.hidden = YES;

        return cell;

    }else{

        ASThirdTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ASThirdTableViewCell" forIndexPath:indexPath];
        cell.cellLabel.text = @"如遇到账号故障、密码、盗号等问题，请及时与客服取得联系400-001-5381";

        return cell;
    }

}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 50;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
